<template>
    <div>
        <h1>会员等级列表</h1>
        <table class="table table-bordered">
            <thead>
                <tr class="bg-primary">
                    <td>ID</td>
                    <td>等级名称</td>
                    <td>累计金额</td>
                    <td>权益</td>
                    <td>创建时间</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in list":key="item.Id">
                    <td>{{item.Id}}</td>
                    <td>{{item.LevelName}}</td>
                    <td>{{item.Money}}</td>
                    <td>{{item.LevelRight}}</td>
                    <td>{{moment(item.CreateTime).format('YYYY-MM-DD')}}</td>
                    <td>
                        <input type="button" value="删除" class="btn btn-success" @click=""/>
                        <input type="button" value="修改" class="btn btn-danger" @click="Update(item.Id)"/>
                    </td>
                </tr>
            </tbody>
        </table>

    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted}from 'vue';
import axios from 'axios';
import moment from 'moment';
import router from '@/router';

const list=ref([{
    "Id": 0,
    "LevelName": "",
    "Money": 0,
    LevelRight:'',
    "CreateTime": "2025-02-24T12:37:53.898Z",
    "UpdateTime": "2025-02-24T12:37:53.898Z",
    "IsDelete": true

}])
//就绪函数
onMounted(()=>{
    show();

})
const show=()=>{
    axios.get('https://localhost:7193/api/Member/GetMemberLevelList').then(res=>{
        debugger
        res.data;
        list.value=res.data;
    })
}
//跳转
const Update=(id:any)=>{
    router.push({
        path:'/MemberUpdate',
        query:{
            id:id
        }
    })
}
</script>

<style scoped>

</style>